package com.zhxq.member.controller;

import com.zhxq.common.core.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.ai.vectorstore.cassandra.CassandraVectorStore;
import org.springframework.ai.vectorstore.filter.FilterExpressionBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/member/common")
@RequiredArgsConstructor
@Tag(name = "通用接口")
public class MemberCommonController {

    @Autowired
    private CassandraVectorStore vectorStore;

    @PostMapping("/testDeleteVectorStore")
    @Operation(summary = "测试删除向量库")
    public AjaxResult testDeleteVectorStore(String fileName) {
        FilterExpressionBuilder b = new FilterExpressionBuilder();
        vectorStore.delete(b.eq("file_name", fileName).build());
        return AjaxResult.success();
    }

}
